<?php
namespace app\api\controller;
use think\Controller;

class City extends Controller  //api
{
    //构造函数 私有属性
	private $obj;
	public function _initialize(){
		$this->obj = model("City");
		}
	
	
	public function getCitysByParentId()
    {
         $id = input('post.id');
		 if(!$id){
			 $this->error('ID不合法');
			 }
		//通过id获得二级城市
		$citys = $this->obj->getNormalCitysByParentId($id);
		if(!$citys){
			    return show(0, 'error');
			}else{
		        return show(1, 'success', $citys);
			}
	}
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
}
?>